UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puOXLO4Rk4QoVQi15f5/R+hQO/EQuAgIySDbCwO86ZU=' 
WHERE 
  key_id = '4109cfa4b3e9dda2c667ced0dd2877557ce191de26438f38597bf6cd04e18453' 
  AND (
    token = 'puOXLO4Rk4QoVQi15f5/R+hQO/EQuAgIySDbCwO86ZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032