UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NvV9bdgq0c+bPxzbQ1NEoUQQVny5BdJzeDw8yi1fyWQ=' 
WHERE 
  key_id = '96a8349e47fc92fbbcb90f00721fda8901a5d2a1240d4eabb51ff2467e57eed8' 
  AND (
    token = 'NvV9bdgq0c+bPxzbQ1NEoUQQVny5BdJzeDw8yi1fyWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031