UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OPe2NS6z0KG1/Su4XcY9ikWWbblFEDMatqQe6rX+XPg=' 
WHERE 
  key_id = 'e024daa9d2573cd6c224988df896bd7907da2c64af73e3bb0cf5ae6637604ea9' 
  AND (
    token = 'OPe2NS6z0KG1/Su4XcY9ikWWbblFEDMatqQe6rX+XPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054