UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pZqY000bgJw9BpcWfwFo4xUQc6Mf7cs5SYMGjP6wvGM=' 
WHERE 
  key_id = 'c4c592c8cca4acf707f504f4eef802bac3d504eba230ed35766219f5d6a7b3f8' 
  AND (
    token = 'pZqY000bgJw9BpcWfwFo4xUQc6Mf7cs5SYMGjP6wvGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046