UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2d0OvJgfPqvJW6czJ0kvbB4JMOuzoJcEcLGpx1pAe5o=' 
WHERE 
  key_id = 'ec69804f624321bc356fe9d32343961555234c9542e79296136f82eeb27b17e6' 
  AND (
    token = '2d0OvJgfPqvJW6czJ0kvbB4JMOuzoJcEcLGpx1pAe5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019