UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ulgr6Tbqg31WO4N0YwjWcytfIpI2KAYBTZDAPbnCWc=' 
WHERE 
  key_id = '31255fe8784c9bba9027766f0a25caff021a776decd2a940563f72a70d209a69' 
  AND (
    token = '8ulgr6Tbqg31WO4N0YwjWcytfIpI2KAYBTZDAPbnCWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035