UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p9D7Zwk9p1e3XJb9fzaQfOdGam+ka0v9IVakQAXvYNg='
WHERE
key_id = '30c493686804e5951346d9f39f9ef4e42286d75f949eeada152fa38f874dc8fc'
AND (
token = 'p9D7Zwk9p1e3XJb9fzaQfOdGam+ka0v9IVakQAXvYNg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)