UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lgymyc+aA6GbxDczXMUA6AQ1p6rIRLuOMRh94VvFaBY='
WHERE
key_id = 'a9814fc0603389e2d19211d35c248535ea45eb75005bf3451d4c143aa9aee139'
AND (
token = 'lgymyc+aA6GbxDczXMUA6AQ1p6rIRLuOMRh94VvFaBY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)