UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i2NFwnaOorrnLHi1PqiXtvymd4qV8J2yKA3reXAJmIo=' 
WHERE 
  key_id = '0039f04be8c907cd47578f3b43e978dc4a64301494d2407a26bb477468be4ea3' 
  AND (
    token = 'i2NFwnaOorrnLHi1PqiXtvymd4qV8J2yKA3reXAJmIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048