UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V8CRlRUZBysZYXHVEWQmfu0QOvR5VfxHtc+tybD5RSU='
WHERE
key_id = 'd5a8e98bec8e879f6c2cb8a60500b17b588964e0670efe03b2717d7be5740705'
AND (
token = 'V8CRlRUZBysZYXHVEWQmfu0QOvR5VfxHtc+tybD5RSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)