UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YTVahaVoASvEdef7J9p2EJeH5ddN6LhbfyrDqSad++c='
WHERE
key_id = 'c461186e2a847f5ed94eb855966f96d085915a9851ad3350af8be48cad84c3c9'
AND (
token = 'YTVahaVoASvEdef7J9p2EJeH5ddN6LhbfyrDqSad++c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)