UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TsZpuNJ+JUqr7yJp7PKkD5vrkaTWUMkHUEfO0pdH1U4='
WHERE
key_id = '49bf91195266d5eebb1914d66c16947774c3b026699a27bb80fa6d0af5f3cce3'
AND (
token = 'TsZpuNJ+JUqr7yJp7PKkD5vrkaTWUMkHUEfO0pdH1U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)