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