UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xt8N2KFXOiK1v/cJdX/9mBgI/VZ4cSSML3sYrIbK5ns='
WHERE
key_id = '8d12804329a8490e711ad28f4fe65e6425ed0dfc586cd437c5ae7a78603b5aef'
AND (
token = 'xt8N2KFXOiK1v/cJdX/9mBgI/VZ4cSSML3sYrIbK5ns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)