UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9serM9PPDbDBWbw7y+qyHBirhmF0swwpIzKDv8R40zo=' 
WHERE 
  key_id = 'd980bf63e0f4a1d77b95bd9e0c8fd9abc808a95ed05bfc31d8643f71cd1b6015' 
  AND (
    token = '9serM9PPDbDBWbw7y+qyHBirhmF0swwpIzKDv8R40zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028