UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tv5fOqLB1wG+yFe2mqGQz/t+T+Fl5mpl/PY4Dhlhj80='
WHERE
key_id = 'e394a002c6ff52742838b72b28f91ae0acf6d9bf6c1ad36e0e50b9aed73a39d7'
AND (
token = 'Tv5fOqLB1wG+yFe2mqGQz/t+T+Fl5mpl/PY4Dhlhj80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)