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

Query time 0.00018