UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hfJmQ1Rk4WueOPXZZ22EysV+EsNofiteyDZZHufE+Js=' 
WHERE 
  key_id = '5e57e835d529507caefdcd3316fee243f1a477d12366ca3899342a26557d022b' 
  AND (
    token = 'hfJmQ1Rk4WueOPXZZ22EysV+EsNofiteyDZZHufE+Js=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022