UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Iz3sz4GOJqImAXFqL4ZUr48T8OzpYNcfzGEIb5DVq9w='
WHERE
key_id = 'd1485643072e5f0cafd751b6d96b7f1e2b773ecb4c1940e7a90b2fe5f55720c4'
AND (
token = 'Iz3sz4GOJqImAXFqL4ZUr48T8OzpYNcfzGEIb5DVq9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)