UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wSqWkeZ2Zk79oZ/dMleQ0aaPSaIkg4ySo2E5A181fr4='
WHERE
key_id = 'd0fb36c74c74d6671c33f15b157bd3b587b89f0d7c773937bc75a85caa3204b6'
AND (
token = 'wSqWkeZ2Zk79oZ/dMleQ0aaPSaIkg4ySo2E5A181fr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)