UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ylw70AZvgHykyd7TAzW6z6i1GW5ut7RZygc2zCNgU/Y='
WHERE
key_id = 'aa84cedc7f31a8a99e1b8802e618f983eca20b343c91ceb100f1d2b90c75b2ff'
AND (
token = 'ylw70AZvgHykyd7TAzW6z6i1GW5ut7RZygc2zCNgU/Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)