UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hgv3wsuamqnRkd6Xt9WZ3jmqZTKgWH8BXlvrP2PVDf8=' 
WHERE 
  key_id = '58a8f2155cd4465b53fe387941fd36279a1350042b8fd010573cc3dd826e42d7' 
  AND (
    token = 'Hgv3wsuamqnRkd6Xt9WZ3jmqZTKgWH8BXlvrP2PVDf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039