UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQmZY4bdRqYIxMGRmqQuwgkTx7kUly7wvux0vwjtGcc=' 
WHERE 
  key_id = '832a8fdac03fb8a722df02f76de101067cce6545f83047f59e3471c77ed7d7e6' 
  AND (
    token = 'iQmZY4bdRqYIxMGRmqQuwgkTx7kUly7wvux0vwjtGcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042