UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZXdxEGphoITUZrZG49+BbYWD6kz/7ObhsXPASjNwQjg=' 
WHERE 
  key_id = '8bb374fd2acabe80e471d7c846875c534dca2d58aab267630dfce25b84feecae' 
  AND (
    token = 'ZXdxEGphoITUZrZG49+BbYWD6kz/7ObhsXPASjNwQjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015