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