UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1eVj3WIbThtIhpKYllm4EPG3l7YzuqGST69EoZZWLbY=' 
WHERE 
  key_id = '69d252dcd0a6bfcc977fa306f402e155a9f5323577a29de528a31d6d81a32ddf' 
  AND (
    token = '1eVj3WIbThtIhpKYllm4EPG3l7YzuqGST69EoZZWLbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038