UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QJwo49qsP+3jz8sCnEoJMtEG8q0sPcsi5Jbdk4FtOQs=' 
WHERE 
  key_id = '9008d68f12fd6d81101bfb206bc70eaf1820d977be6d576f4d67ee59821bdc45' 
  AND (
    token = 'QJwo49qsP+3jz8sCnEoJMtEG8q0sPcsi5Jbdk4FtOQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039