UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UOaKq2cYKOOpqqdUzYpvdwdki6b0V131m6mOrGVUH+0='
WHERE
key_id = 'f8bf05f26896f0a447c5cdeb23943b41b9818fcf2b9d4084b7d77bf426dc290d'
AND (
token = 'UOaKq2cYKOOpqqdUzYpvdwdki6b0V131m6mOrGVUH+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)