UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HdNOCx0A9xoC7HjAY77sG9feCSz1RIUxlfI7KfwHugM='
WHERE
key_id = 'cf4d825a65be4a8131e294ab9e051bf1cfd20d87818281fe5b7c2ab7ea6e8b73'
AND (
token = 'HdNOCx0A9xoC7HjAY77sG9feCSz1RIUxlfI7KfwHugM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)