UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JHBCfEfCmpsL6f8rGd/1nem1D2BrlhF1koeTXlD1e3U=' 
WHERE 
  key_id = '81df65a6c6600d0bbdb7a441b723b91331f669815192d6fff3757022d4987d86' 
  AND (
    token = 'JHBCfEfCmpsL6f8rGd/1nem1D2BrlhF1koeTXlD1e3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035