UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W99GeRsy4W/WsvjLYpLjdyScRjw4Y9KtYwxufE0Lrto='
WHERE
key_id = '7396b67a140a47c687eee89a2bc3d2722c214cee8a01250ca896bc29b46d5709'
AND (
token = 'W99GeRsy4W/WsvjLYpLjdyScRjw4Y9KtYwxufE0Lrto='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)