UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+lIxTYkazCk9e6WBcW8w5lS7HIoZqVH7T4HIhepjT58='
WHERE
key_id = '6376e4523aa57463a997eaabe6d4601ce08bb025c456240d7dfd9b26fa65bc05'
AND (
token = '+lIxTYkazCk9e6WBcW8w5lS7HIoZqVH7T4HIhepjT58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)