UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '50zKhNHMu9AzE5eSRJY3PfepmgNGanh0xzkROtAExgY=' 
WHERE 
  key_id = 'aa6e03ab40b6e66cb3e125dc789286809b4b898586e84aca18c88bff546860cb' 
  AND (
    token = '50zKhNHMu9AzE5eSRJY3PfepmgNGanh0xzkROtAExgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019