UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UO+GfX2Brb4gsXv96995YfCihV+UyrxUDmSqh0LtNj8=' 
WHERE 
  key_id = '81cb8cb7aece27e861be63944b62f226648bd544d4a98b7375c60c67525f21c1' 
  AND (
    token = 'UO+GfX2Brb4gsXv96995YfCihV+UyrxUDmSqh0LtNj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028