UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9DdsbqESWCwglCRBXBvBd1jpN+O/f/7MESyVz5ecneU=' 
WHERE 
  key_id = '3c6cb9ba9ab247269e5827408f476b191fa799942010e8e24c328ec9613d6046' 
  AND (
    token = '9DdsbqESWCwglCRBXBvBd1jpN+O/f/7MESyVz5ecneU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030