UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IfvWtlbwrjbPcsKdyHHkVhEF3ZGLLSmP/+0gyS+Y8Js='
WHERE
key_id = '9e37ed8ef74d47f6b9f63ee344655ea165c348d226e07edb2d76d7dd22af03f4'
AND (
token = 'IfvWtlbwrjbPcsKdyHHkVhEF3ZGLLSmP/+0gyS+Y8Js='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)