UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0JQUo1YevPRUfg+mbvGBW20TuYopUwKGgokYg9D33V0='
WHERE
key_id = '4aface61ac977186b43fe5fb0989a0d40ae46ba191e5b034700ac5a95e75a9e1'
AND (
token = '0JQUo1YevPRUfg+mbvGBW20TuYopUwKGgokYg9D33V0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)