UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aeohkOn3WDnspHcEdo8K1BMtMrJZ9Blv751ao2xH+9c='
WHERE
key_id = '7c0162ac993ee2aa9a05199bb20acb543009a4604731e7c57b5df3ece46414b1'
AND (
token = 'aeohkOn3WDnspHcEdo8K1BMtMrJZ9Blv751ao2xH+9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)