UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KfuU+y5AAVcFD3UvHQI8+E2bsfHkN5vyfjilG1PnX/U='
WHERE
key_id = 'f56e483060766c8a63fda29afcd53b35059bb9a4f3ecc2232648990e27f03cd5'
AND (
token = 'KfuU+y5AAVcFD3UvHQI8+E2bsfHkN5vyfjilG1PnX/U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)