UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nr/5+6GELsKmomSdHBePC2hbz5lDMofmKiKNtPOWXpM=' 
WHERE 
  key_id = '511692d3865ccd4f9a4a328d2e32c61f91037ce6bb27345650d855b9d06dee5c' 
  AND (
    token = 'Nr/5+6GELsKmomSdHBePC2hbz5lDMofmKiKNtPOWXpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028