UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QdeCT5msigcyrNgcFGVboIGvpoGPWRl9QbvvWT2QTb4='
WHERE
key_id = '80b24d3fa2dd89498fa2ab6bb7e98ceb892ac05b1dd3d7a76ae27b91b0389ef2'
AND (
token = 'QdeCT5msigcyrNgcFGVboIGvpoGPWRl9QbvvWT2QTb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)