UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRiXCyvkWXhAJKWdBgQBaSACv6CXCpg6NLKSJuCGUxA=' 
WHERE 
  key_id = '1b771ac8d46161b073412c88ece5e2c077de3585906db69325a6895a05c85e32' 
  AND (
    token = 'KRiXCyvkWXhAJKWdBgQBaSACv6CXCpg6NLKSJuCGUxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026