UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5DpWbfFiy+S78ggxTX9DU0PEBcQY5m2mOaeUGoOnBX4='
WHERE
key_id = '528073b7bef43dc6e34242cd2834dd618940fa7b23c41f4c0e1fdd59f61d1873'
AND (
token = '5DpWbfFiy+S78ggxTX9DU0PEBcQY5m2mOaeUGoOnBX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)