UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8GNLkJGnr+oTGi9+R1Ea6l4htQGlWOxKTSKLs4ixAAA=' 
WHERE 
  key_id = '9616954e864d7ce8a36241c7958f5474656d8555900aedec225ba6c3720a3ec4' 
  AND (
    token = '8GNLkJGnr+oTGi9+R1Ea6l4htQGlWOxKTSKLs4ixAAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032