UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xwDn70JMl/2MTSv+JM6MS0Cmtp+fchIehqGnVbW9BEI='
WHERE
key_id = '1afc348342e9e8768622cc846e0b7a00314efefc4ad70eb813a23f9a24ab4715'
AND (
token = 'xwDn70JMl/2MTSv+JM6MS0Cmtp+fchIehqGnVbW9BEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)