UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tO3CQunktcJRjaavqiYL3ZeToMb9mNlPd4RkwMRew40=' 
WHERE 
  key_id = '15610775d618d81eeedd976f3aabe45741f4c9c4846d7bb6f94aff5f13fbb442' 
  AND (
    token = 'tO3CQunktcJRjaavqiYL3ZeToMb9mNlPd4RkwMRew40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032