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