UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w8OsFW+VUio6PhpJcQEriX9zg0C9w41zJ5nowRzvPqI='
WHERE
key_id = 'a22c37d266d442d8a9ebe93589a79c6d71300b806e38c6128eab653c93c193f0'
AND (
token = 'w8OsFW+VUio6PhpJcQEriX9zg0C9w41zJ5nowRzvPqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)