UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M4+y+XzEkH8pPTvjkaVX/Cod/ox6mQ4N/yDq4Psvin4=' 
WHERE 
  key_id = '5daec8f8babce134e697409d3c17d100aa6171649379cc7ba3d5e7f9259c090a' 
  AND (
    token = 'M4+y+XzEkH8pPTvjkaVX/Cod/ox6mQ4N/yDq4Psvin4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018