UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TUg5F1QCSghE3lzGAXU8su2XkMgQX4xcJF6el/zQwtU='
WHERE
key_id = 'f1229cc65f0a961992bd430b8ffd029415e74e3b7c8520c338c7ef45f2c6a5d7'
AND (
token = 'TUg5F1QCSghE3lzGAXU8su2XkMgQX4xcJF6el/zQwtU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)