UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IXOu3bbbnTns9rJVF78Zq2xE1Jskmu+m+uEE8r8KgB8='
WHERE
key_id = '0a37915991cf041d5fdb5798bea6af4f8c361685438df3277a87148ed2b65435'
AND (
token = 'IXOu3bbbnTns9rJVF78Zq2xE1Jskmu+m+uEE8r8KgB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)