UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YzOUIcCohTPHgHgUflcWDZ0H7NUo7QbBVbV+uYq7r+E=' 
WHERE 
  key_id = '16593024115e79dfa66bed05bfba100d08dc3a9f4862392c884725bc834498bf' 
  AND (
    token = 'YzOUIcCohTPHgHgUflcWDZ0H7NUo7QbBVbV+uYq7r+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026