UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HaYRzJXYfSfqEq6OaeNrxoleyDMKDswoBNR84c8A9Mk='
WHERE
key_id = '02c5977eb06f6594f0b7cc6287c71a1921e1150a0a1e67e00ec19ad96ef30ae8'
AND (
token = 'HaYRzJXYfSfqEq6OaeNrxoleyDMKDswoBNR84c8A9Mk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)