UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '57QnNbu7UM3VkGL2q/G1nSlfEO1HrTABJ1FIfzGPxJ8=' 
WHERE 
  key_id = '7b0b1b10a1462462d369b16f03550e3023c0f0b0984fcdc701e5e41bc4a7208d' 
  AND (
    token = '57QnNbu7UM3VkGL2q/G1nSlfEO1HrTABJ1FIfzGPxJ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045