UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BGQAbo4M5H4bBe31kEgM8bUnDZKpx8GewEbMdg0t0S0='
WHERE
key_id = '2e45ca89eedbad00cd66a90ab646f5021de0715bde50e535d70eacc59fa7a72c'
AND (
token = 'BGQAbo4M5H4bBe31kEgM8bUnDZKpx8GewEbMdg0t0S0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)