UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'duq0iC5OKNJzESYER+V+f6B3nUEF1/n/n4JXa4qPJyE='
WHERE
key_id = '091a79727eef9d9844f2a3358963df0e037a4bd5cdd37ee2f62a25c7150dbe99'
AND (
token = 'duq0iC5OKNJzESYER+V+f6B3nUEF1/n/n4JXa4qPJyE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)