UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sCPaJS2R83xewwKLsIuJeukn8mJcOh2UKGyKLv2Bfm4=' 
WHERE 
  key_id = '54fb852707be6beed530e11712e590e7c61b07717783edf238bf68c67317e04c' 
  AND (
    token = 'sCPaJS2R83xewwKLsIuJeukn8mJcOh2UKGyKLv2Bfm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048