UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9BsMHZhRlLUHk8kgwP6rIVbBc2exGQxjxNPrBmfy3YI='
WHERE
key_id = '413def59a3f85b9f7c0a225c9642879529141d202e2c836a103d3680d8e6f6b2'
AND (
token = '9BsMHZhRlLUHk8kgwP6rIVbBc2exGQxjxNPrBmfy3YI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)