UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qq3xg9sASIS2gJA05OJxBODjIGF4PXamOSqGtPLQC2o=' 
WHERE 
  key_id = 'e3002515d1c15484919bf02b76cc7b86754ddad44654a3fe37f98ca3d006a284' 
  AND (
    token = 'Qq3xg9sASIS2gJA05OJxBODjIGF4PXamOSqGtPLQC2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036