UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnrPhCg0AQQ/niiXoNMnEjpE/MMKlz5WuRur3LJDrbs=' 
WHERE 
  key_id = '5a137e05e18f6f2329344520cfd7080986bcbc5deb95f28e283a13be5768243b' 
  AND (
    token = 'TnrPhCg0AQQ/niiXoNMnEjpE/MMKlz5WuRur3LJDrbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026