UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0r9eXYREPD/LPwQVs0y2MlzS9Mejf9SWOpqikPLUohI=' 
WHERE 
  key_id = '89d7df04f547df20a882d1d50e9db62197518deaea8863e89cee1c0de5ed2ae7' 
  AND (
    token = '0r9eXYREPD/LPwQVs0y2MlzS9Mejf9SWOpqikPLUohI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038