UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kfKWY9M+YKTXLnMBkbyosq5OKbEkYKStlQhcJgcNzAM=' 
WHERE 
  key_id = '394fba4ea2a0009e49c50805c1cbcf7b059274cfb0215223b1e401a9b2893d24' 
  AND (
    token = 'kfKWY9M+YKTXLnMBkbyosq5OKbEkYKStlQhcJgcNzAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033