UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BOK9M8FKwyh5QOdR0CbRw8UR+jlJjJuqMkIGUOGlyio=' 
WHERE 
  key_id = '3a8aa46821007f6191978624d873f26d18a3845125ca5113b788ad9e84e5a903' 
  AND (
    token = 'BOK9M8FKwyh5QOdR0CbRw8UR+jlJjJuqMkIGUOGlyio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025